-- CALC_HIDE_STORAGE_BOX_BONUS

-- 计算隐藏的储物箱奖励（隐藏物件）
-- @param user      玩家对象
return function(user, bonusArg)
    local rand = DungeonM.getRandSeed("HIDDEN_STORAGE_BOX") % 100;
    local rand2 = DungeonM.getRandSeed("HIDDEN_STORAGE_BOX");
    local classId;
    local dungeonId = CaveHideItemM.getParentDungeonId();
    local arr1 = {};
    local class = bonusArg.class;
    local specialBonusCount = CaveHideItemM.getSpecialBonusCount(class);

    if rand < 40 and specialBonusCount <= 0 then
        -- 统计特殊奖励出现次数
        CaveHideItemM.statSpecialBonusCount(class);

        -- 冒险者の森
        if dungeonId == 1 then
            return { 1, 7161, 1 };
        end

        -- 英雄の村
        if dungeonId == 2 then
            return { { 1, 7007, 1 }, { 1, 7072, 2 }, };
        end

        -- 遗落の圣坛
        if dungeonId == 3 then
            arr1 = { 5115, 5125, 5135, 5145, 5155, 5165, };
            return { 1, FormulaM.invoke("FETCH_BY_RAND", arr1, rand2), 1 };
        end

        -- 废弃边陲
        if dungeonId == 4 then
            return { { 1, 8090, 1 }, { 1, 8091, 1 }, { 1, 8092, 1 }, };
        end

        -- 古代竞技场
        if dungeonId == 5 then
            return { { 1, 8087, 1 }, { 1, 8088, 1 }, { 1, 8089, 1 }, };
        end

        -- 低语の森
        if dungeonId == 6 then
            arr1 = { 7012, 7013, 7014, 7015, };
            return { { 1, 7011, 1 }, { 1, FormulaM.invoke("FETCH_BY_RAND", arr1, rand2), 2 }, };
        end

        -- 圣者の塔
        if dungeonId == 7 then
            return { { 1, 8075, 1 }, { 1, 8076, 1 }, { 1, 8077, 1 }, };
        end

        -- 砂漠の绿洲
        if dungeonId == 8 then
            return { { 1, 7168, 3 }, { 1, 7169, 2 }, };
        end

        -- 血腥要塞
        if dungeonId == 9 then
            return { { 1, 8081, 1 }, { 1, 8082, 1 }, { 1, 8083, 1 }, };
        end

        -- 德古拉城堡
        if dungeonId == 10 then
            return { 1, 7241, 30 };
        end

        -- 海贼の港
        if dungeonId == 1001 then
            return { 1, 7033, 20 };
        end

        -- 骷髅岛
        if dungeonId == 1002 then
            return { { 1, 7050, 1 }, { 1, 7052, 1 }, };
        end

        -- 阿瓦隆要塞
        if dungeonId == 1004 then
            arr1 = { 7316, 7317, };
            return { { 1, FormulaM.invoke("FETCH_BY_RAND", arr1, rand2), 1 }, };
        end

        -- 蒸汽之都
        if dungeonId == 1003 then
            return { { 1, 7566, 2 }, { 1, 7568, 1 }, { 1, 7569, 2 }, };
        end
    else
        local rand1 = DungeonM.getRandSeed("HIDDEN_STORAGE_BOX") % 100;
        local amount;

        if rand1 < 55 then
            amount = rand2 % (50 + 1) + 30;
            return { 2, "search_point", amount };
        elseif rand1 < 85 then
            arr1 = { 5011, 5012, 5013, 5014, 5061, 5062, 5063, 5064, };
            return { { 1, FormulaM.invoke("FETCH_BY_RAND", arr1, rand2), 1 }, };
        else
            arr1 = { 5021, 5022, 5023, 5024, 5071, 5072, 5073, 5074, };
            return { { 1, FormulaM.invoke("FETCH_BY_RAND", arr1, rand2), 1 }, };
        end
    end

    return {};
end
